/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.velocityme.session;

import com.velocityme.entity.Node;
import com.velocityme.entity.Search;
import com.velocityme.entity.Activity;
import com.velocityme.entity.Contactable;
import com.velocityme.entity.Transition;
import com.velocityme.enums.Permission;
import com.velocityme.utility.SearchEntry;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.ejb.Local;

/**
 *
 * @author rcrida
 */
@Local
public interface SearchLocal {

    enum ReportColumns { STATE_CHANGES, COMMENTS, RESPONSIBILITY };

    Set<Permission> getAssignedPermissions(KeyLocal key, Node node);

    Search createSearchSpace(KeyLocal key, Node node, boolean down);

    Search createSearchSpaceFiltered(KeyLocal key, Node node, Collection<Node> exclusionNodes, boolean down);

    void removeSearchSpace(KeyLocal key, Search search);

    List<Activity> findAllMyResponsibleTasks(KeyLocal key);

    List<Activity> findAllMyInterestedTasks(KeyLocal key);

    List<Activity> findMyResponsibleTasks(KeyLocal key, Node node);

    List<Activity> findMyInterestedTasks(KeyLocal key, Node node);

    List<Activity> findActiveTasks(KeyLocal key, Node node);

    List<Activity> findParameterSearch(KeyLocal key, Long nodeId, Set<Long> ids, Set<String> keywords, Date start, Date stop, Set<Long> statusIds, Set<Long> contactableIds);

    List<Activity> findCompletedTasks(KeyLocal key, Long nodeId, Date start);

    List<Activity> findChangedTasks(KeyLocal key, Long nodeId, Date start, Date stop);

    List<Activity> findContactablesResponsibleTasks(KeyLocal key, Long nodeId, Collection<Long> contactableIds, boolean includeDescendents);

    List<Contactable> getContactablesAssignedToTransition(KeyLocal key, Node node, Transition transition);

    List<SearchEntry> getSearchReport(KeyLocal key, Node rootNode, Collection<Activity> nodeSearchResults, Set<ReportColumns> reportColumns);
    
}
